package cn.wch.ch934xlib.chip;

import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;

import java.util.ArrayList;

public class ChipEntity {
    private ChipType chipType;
    private UsbDevice usbDevice;
    //接口
    private UsbInterface usbInterface;
    //端点
    private UsbEndpoint bulkEpOut;
    private UsbEndpoint bulkEpIn;
    private UsbEndpoint ctrlEpOut;
    private UsbEndpoint ctrlEpIn;

    public ChipType getChipType() {
        return chipType;
    }

    public void setChipType(ChipType chipType) {
        this.chipType = chipType;
    }

    public UsbDevice getUsbDevice() {
        return usbDevice;
    }

    public void setUsbDevice(UsbDevice usbDevice) {
        this.usbDevice = usbDevice;
    }

    public UsbInterface getUsbInterface() {
        return usbInterface;
    }

    public void setUsbInterface(UsbInterface usbInterface) {
        this.usbInterface = usbInterface;
    }

    public UsbEndpoint getBulkEpOut() {
        return bulkEpOut;
    }

    public void setBulkEpOut(UsbEndpoint bulkEpOut) {
        this.bulkEpOut = bulkEpOut;
    }

    public UsbEndpoint getBulkEpIn() {
        return bulkEpIn;
    }

    public void setBulkEpIn(UsbEndpoint bulkEpIn) {
        this.bulkEpIn = bulkEpIn;
    }

    public UsbEndpoint getCtrlEpOut() {
        return ctrlEpOut;
    }

    public void setCtrlEpOut(UsbEndpoint ctrlEpOut) {
        this.ctrlEpOut = ctrlEpOut;
    }

    public UsbEndpoint getCtrlEpIn() {
        return ctrlEpIn;
    }

    public void setCtrlEpIn(UsbEndpoint ctrlEpIn) {
        this.ctrlEpIn = ctrlEpIn;
    }

    public boolean isValid(){
        return bulkEpIn!=null && bulkEpOut!=null && ctrlEpIn!=null && ctrlEpOut!=null ;
    }

    @Override
    public String toString() {
        return "ChipEntity{" +
                "chipType=" + chipType +
                ", bulkEpOut=" + bulkEpOut.getEndpointNumber() +
                ", bulkEpIn=" + bulkEpIn.getEndpointNumber() +
                ", ctrlEpOut=" + ctrlEpOut.getEndpointNumber() +
                ", ctrlEpIn=" + ctrlEpIn.getEndpointNumber() +
                '}';
    }

}
